

import javax.swing.JOptionPane;
/**
 * User.java logs in a user into the database, and keeps track of the current user for all other parts
 * of the spreadsheet program
 *   
 * @author Andrew Gifford, Bryan Gago
 */
public class User
{

	public static String currentUser;
	/**
	 * login sets up a input dialog and tries to login the user into the database
	 * 
	 */
	public static boolean login()
	{
		//if username is in the database
		String temp = JOptionPane.showInputDialog(null, "What is your username?");
		if(temp == null){
			return false;
		}
		String user = temp.toLowerCase().trim();
		if(user!= null && DatabaseUtil.userInDB(user))
		{
			currentUser = user;
			return true;
			
		}
		else{
			return false;
		}
	}
}
